import jieba



# 用jieba的精确模式分词,统计分词后的中文词语语频
if __name__ == '__main__':
    fo  =open("data2.txt","w",encoding="utf-8")
    s = input("请输入一个中文字符串，包含逗号和句号：\n")
    k = jieba.lcut(s)
    d1={}
    for i in k:
        d1[i]=d1.get(i,0)+1
    for key,value in d1.items():
        fo.write(key+":"+str(value)+"\n")